#include <stdio.h>
#include "led_driver.h"
#include "key_drv.h"
#include "delay.h"
#include "systick.h"
#include "usb2com_drv.h"
#include "store_app.h"
#include "wifi_drv.h"
#include "wifi_app.h"
#include "ntc_drv.h"
#include "rh_drv.h"
#include "rtc_drv.h"
#include <time.h>

int main()
{
	uint8_t keyVal = 0;
	
	LedDrvInit();
	DelayInit();
	KeyDrvInit();
	SystickInit();
	Usb2ComDrvInit();
	WifiDrvInit();
	TempDrvInit();
	HumiDrvInit();
	InitSysParam();
	RtcDrvInit();
	
//	RtcTime_t time ={2025, 11, 3, 10, 42, 50};
//	SetRtcTime(&time);
	
	while (1)
	{
		WifiNetworkTask();
		TempDataProc();
		HumiSensorProc();
		keyVal = GetKeyVal();
//		GetRtcTime(&time);
//		printf("%d-%02d-%02d %02d:%02d:%02d\n", time.year, time.month, time.day,
//											time.hour, time.minute, time.second);		
//		DelayNms(1000);
		switch (keyVal)
		{
			case KEY1_SHORT_PRESS:
				ToggleLed(LED1);
				break;

			case KEY2_SHORT_PRESS:
				ToggleLed(LED2);
				break;
			case KEY2_LONG_PRESS:
				TurnOffLed(LED2);
				break;
			default:
				break;
		}
	}
}
  
